import {MD5} from "./md5";
/**
 * Created by ybjaa on 2017/6/26.
 */
export class security{

    /**
     * @type {RegExp} 用户名验证串
     */
    public static userNameRegexp:RegExp=/^[\x21-\x7e]*$/;

    /**
     *
     * @type {RegExp} 密码验证串
     */
    public static passwordRegexp:RegExp=/^[\x21-\x7e]*$/;


    static encrypt(password:string):string {
        let str1=MD5.createHash(password.trim());
        let str2=MD5.createHash(str1);
        let str3=str1+str2;
        let length=str3.length;
        let str4="";
        for(let i=0;i<length;i+=2)
        {
            str4+=str3.charAt(i);
        }

        return MD5.createHash(str4.toUpperCase());
    }

}